﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Data.Car_Rental;
using Entity.Car_Rental;
using Entity;
namespace Car_Rental.Controllers
{
    public class ShopController : Web.Commons.BaseController
    {
        IShopRepository iShopRepository = null;
        public ShopController()
        {
            iShopRepository = new ShopRepository();
        }
        //
        // GET: /Shop/

        public ActionResult Index()
        {
            return View();
        }

        /// <summary>
        /// 根据区域ＩＤ，得到门店列表
        /// </summary>
        /// <param name="areaID"></param>
        /// <returns></returns>
        public ActionResult ShopListByAreaID(string area, int length = 2, int? page = 1)
        {
            VP = new VPredication();
            PP = new PagingParam(page ?? 1, base.PageSize);

            VP.AddItem("length", length);
            if (!string.IsNullOrEmpty(area))
                VP.AddItem("area", area);

            var model = iShopRepository.GetShopByAreaID(VP, PP);
            return View(model);

        }
    }
}
